package cn.xdmnb.cloud.blog.core.model;

import cn.hutool.core.net.URLDecoder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.StringUtils;

import java.nio.charset.StandardCharsets;

/**
 * @author yukai
 * @since 2023年01月05日 15:51
 */
@ApiModel("分页参数")
public class BaseParam {

    @ApiModelProperty("页码")
    private Integer pageNum;

    @ApiModelProperty("每页数量")
    private Integer pageSize;

    @ApiModelProperty("关键字")
    private String keyWord;

    @ApiModelProperty("用户id")
    private String userId;

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getKeyWord() {
        return StringUtils.hasText(this.keyWord) ? URLDecoder.decode(keyWord, StandardCharsets.UTF_8) : this.keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
}
